<template>
  <el-row class="tac">
    <el-col>
      <el-menu default-active="2"  v-for="list in lists" :key="list.url" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
        <el-submenu :index="list.url">
          <template slot="title">
            <router-link :to="list.url" class="clearStyle headers"><span>{{list.title}}</span></router-link>
          </template>
            <el-menu-item @click="toPage(item.link.replace('/',''))" v-for="item in list.childrens" :key="item.index1" :index="item.index1"><router-link :to="item.link" class="clearStyle">{{item.storeName}}</router-link></el-menu-item>
        </el-submenu>
      </el-menu>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: 'asideMenu',
  props: [
    'lists'
  ],
  data () {
    return {

    }
  },
  methods: {
    handleOpen (key, keyPath) {
      // console.log(key, keyPath)
      this.checkTitle(key.replace('/', ''))
    },
    handleClose (key, keyPath) {
      // console.log(key, keyPath)
      this.checkTitle(key.replace('/', ''))
    },
    toPage (com) {
      // console.log(com)
      this.$emit('toPage', com)
    },
    checkTitle (url) {
      this.$emit('nowTitle', url)
    }

  }
}
</script>

<style scoped>
.tac{
  height: 100%;
  width: 100%;
  background-color: #545c64;
}
.el-menu{
  border:none;
}
li.el-menu-item{
  padding: 0 !important;
}
.clearStyle{
  text-decoration: none;
  color:white;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0 45px 0 40px;
  box-sizing: border-box;
}
  .headers{
    padding-left: 0;
  }
</style>
